package com.wanrue.prometheus.beans;

import com.wanrue.prometheus.properties.DiscoveryConfig;
import com.wanrue.prometheus.service.impl.NacosApiService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(DiscoveryConfig.class)
public class Beans {

    @Bean
    @ConditionalOnProperty(prefix = "discovery", name = "mode", havingValue = "nacos")
    public NacosApiService nacos(DiscoveryConfig discoveryConfig) {
        return new NacosApiService(discoveryConfig);
    }

}
